<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FBA库存报表</title>
<style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
.red,.red td{color:red !important;}
-->
</style>
<body class="withvernav">
<style type="text/css">
	thead tr td{
		vertical-align: middle ; text-align: center;
	}
	.stdtable tbody tr td {padding:3px 0px !important;}
</style>
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">FBA库存报表<span class="pagedesc" style="font-size:14px;">(库存日期：{{$stock_update_time}}) <span class="red">(注：标红为本地找不到商品的sku)</span></span></h1>
     
</div>
<!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper" >
      <div id="basicform" class="subcontent">
          <!--搜索栏-->
<div class="page">{{$pageList}} 计{{$datatotal}}条记录，共{{$totalpage}}页</div>
    <form class="stdform stdform2" method="get" action="/report/fbaStock">
      <div class="tableoptions" style="position:relative"><span style="display:none">所属平台: 
   <select id="platform" name="platform">
            <option value="">-请选择-</option>
            <option value="ebay">ebay</option>
            <option value="Amazon">Amazon</option>
            <option value="1号店">1号店</option>
            <option value="淘宝">淘宝</option>
            <option value="Tmall">Tmall</option>
            <option value="ioffer">ioffer</option>
        </select>
       &nbsp;&nbsp;</span>&nbsp; SKU：<input type="text" name="search_sku" id="search_sku" value="{{$search_sku}}" class="width100">&nbsp;
       销售状态：<select name="selltype" id="selltype">
		  <option value="SELLABLE" {{if $selltype=='SELLABLE'}} selected{{/if}}>可售商品</option>
   		  <option value="UNSELLABLE" {{if $selltype=='UNSELLABLE'}} selected{{/if}}>不可售商品</option>
          <option value="UNKNOWGoods" {{if $selltype=='UNKNOWGoods'}} selected{{/if}}>未知商品</option>
        </select>&nbsp;
        <span id="search_list">{{$shopname|getstr:35}}</span>
<input name="shopname" id="shopname" type="hidden" value="{{$shopname}}" />
<span id="choose_shop_btn" style="border:1px solid #ccc;padding:6px 5px 7px;border-radius:3px;cursor:pointer;" onClick="getShopList()">选择店铺 <img src="/fuman/images/search_down.png" width="14" height="21" align="absmiddle" style="margin-bottom:-4px;"></span>

&nbsp; 
        <button class="btn btn_orange btn_search radius50">Search</button>
        
        <span class="page" style="background-color#fff;border:none;">
        <a href="/report/ajaxbutton?op=reportStore&search_sku={{$search_sku}}&selltype={{$selltype}}&orderstr={{$orderstr}}&shopname={{$shopname}}" target="_blank">导出结果到Excel</a></span>

<div style="position:absolute;right:2px;top:14px;font-size:14px;padding-right:40px;">
 合计 总库存数：<strong class="STYLE1">{{$total_stock}}</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
总成本价值：<strong class="STYLE1">{{$total_costprice}}</strong>
</div>
</div>
    </form>
    <!--搜索栏结束-->
             <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
          
            <thead>
              <tr valign="top" class="tableheader">
                <td>NO.</td>
      <td><a href="javascript:void(0)" title="点击排序" onClick="paixu('sku','{{if $orderbyst=='desc'}}asc{{else}}desc{{/if}}')">商品编号</a><img src="/fuman/images/{{if $orderbyst=='desc'}}arrowdown{{else}}arrowup{{/if}}.png"></td>
      <td><b>名称</b></td>
      <td align="center"><a href="javascript:void(0)" title="点击排序" onClick="paixu('Quantity_num','{{if $orderbyst=='desc'}}asc{{else}}desc{{/if}}')">总库存数</a><img src="/fuman/images/{{if $orderbyst=='desc'}}arrowdown{{else}}arrowup{{/if}}.png"></td>
      <td align="center"><b>总成本价值</b></td>
      <td align="center"><strong>在售店铺数</strong></td>
              </tr>
            </thead>
          
             {{foreach from=$list item=res key=key}}
             <tr {{if $res.goods_name==''}} class="red"{{/if}}>
               <td class="head1" align="center">{{$key+1}}</td>
              <td class="head1" align="center"><a href="/product/productlist?other={{$res.sku}}" target="_blank">{{$res.sku}}</a></td>
                <td class="head0" align="center" title="{{$res.goods_name}}">{{$res.goods_name|getstr:20:0}}</td>
              <td class="head1" align="center">{{$res.Quantity_num}}</td>
               <td class="head1" align="center">{{$res.costprice_num}}</td>
               <td class="head1" align="center"><span title="{{$sale_shops[$res.sku]}}">{{$sale_shops[$res.sku]|getstr:16:0}}个 <a href="javascript:showConifrmForm('{{$res.sku}}')">详细</a></span></td>
             </tr>
            {{/foreach}}
             <tr>
               <td align="center" class="head1"><strong>合计：</strong></td>
               <td align="center" class="head1">&nbsp;</td>
               <td align="center" class="head0" title="{{$res.goods_name}}">&nbsp;</td>
               <td align="center" class="head1"><span class="STYLE1">{{$total_stock}}</span></td>
               <td align="center" class="head1" ><span class="STYLE1">{{$total_costprice}}</span></td>
               <td align="center" class="head1" >&nbsp;</td>
             </tr>
          </table>
      </div>
<div class="page">{{$pageList}} 计{{$datatotal}}条记录，共{{$totalpage}}页</div>
      </div>
<div style="position:absolute;z-index:999;top:105px;border:1px solid #666;left:220px;width:870px;background:#f5f5f5;padding:6px 10px;height:450px;margin-bottom:40px;display:none;" id="ajax_box">
<div style="padding-top:8px;padding-left:12px;height:28px;"><h4 style="float:left">选择要搜索的店铺</h4><span style="float:right">
  <input type="button" name="button" id="button" onClick="setShopInfo()" value="确定选择">&nbsp;&nbsp;
  <input type="button" value="关闭弹层" onClick="closeShowBox()">
</span></div>
<div id="shop_box" style="height:400px;overflow:auto"></div>
</div>

<div class="modal fade" id="endorderform" tabindex="-1" role="dialog" aria-labelledby="sendorderform" aria-hidden="true">
    <div class="modal-dialog" style="width:440px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sendorderform">在售商铺列表</h4>
        </div>
        <div class="modal-body">
         <span id="errshow"></span>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          
          <div style="width:100%;overflow:auto; border:0px solid;">
           <span id="endorderlistst">
           </span>
           <span id="fileinput"></span>
          </div>
          </table>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
<script type="text/javascript" src="/fuman/js/report.js"></script>
<script type="text/javascript">
	function paixu(colnum,ordertype){
		var orderstr=colnum+"__"+ordertype;
		var current_url="?platform="+getPar("platform")+"&search_sku="+getPar("search_sku")+"&selltype="+getPar("selltype")+
						"&orderstr="+orderstr+"&shopname="+getPar("shopname");
		this.location.href=current_url;
			
	}
	
	function showConifrmForm(dataid){
		var selltype=$("#selltype").val();
		$.get("/report/ajaxbutton?op=getShopSaleNum",{"sku":dataid,'selltype':selltype},function(data){
			$("#endorderlistst").html(data);
			$('#endorderform').modal('show');
			///sales/ajaxbutton?op=updateStock&needid=	
		})
	}
		
	function getPar(par){
		//获取当前URL
		var local_url = document.location.href; 
		//获取要取得的get参数位置
		var get = local_url.indexOf(par +"=");
		if(get == -1){
			return '';   
		}   
		//截取字符串
		var get_par = local_url.slice(par.length + get + 1);    
		//判断截取后的字符串是否还有其他get参数
		var nextPar = get_par.indexOf("&");
		if(nextPar != -1){
			get_par = get_par.slice(0, nextPar);
		}
		return get_par;
	}
</script>
</body>
</html>